<?php
/*! \brief
 * This is AWidgetPoolFactory class
 * This is the Simple Factory Class that generate widget pool relative object
 * And shot cut of widget pool relative object 
 * \author William Su
 */
require_once 'WidgetPoolFactory.abstract.php';
class WFWidgetPoolFactory extends AWidgetPoolFactory
{
    /**
     *\brief Description
     * Get PATH of current WidgetPool
     * EX : /path/to/repository/widgetPool/wp1
     * @return string
     */
    public function getWPHome(){
        if(! isset(self::$instance[__FUNCTION__])){
            if(! defined('WP_HOME')){
                require (self::getDirnameFile() . '/../../../repository/widgetPool/config.php');
            }
            //return WP_HOME;
            self::$instance[__FUNCTION__] = WP_HOME;
        }
        return self::$instance[__FUNCTION__];
    }
    /**
     *\brief Description
     * Get PATH of current WidgetPool with no slash in prefix
     * EX : repository/widgetPool/wp1
     * @return string
     */
    public function getWPWebrootNoSlash(){
        if(! isset(self::$instance[__FUNCTION__])){
            if(! defined('WP_WEBROOT_NO_SLASH')){
                require (self::getDirnameFile() . '/../../../repository/widgetPool/config.php');
            }
            //return WP_WEBROOT_NO_SLASH;
            self::$instance[__FUNCTION__] = WP_WEBROOT_NO_SLASH;
        }
        return self::$instance[__FUNCTION__];
    }
    public function setWPHomeByLogId($intLogId){
        self::$instance['getWPHome'] = self::getDirnameFile() . '/../../../repository/widgetPool/wp' . $intLogId;
    }
    public function getWFHome(){
        $ret = self::getDirnameFile() . '/../../..';
        return $ret;
    }
}